/*************************************************************************

    SlkAction.h

*************************************************************************/

#ifndef _SLKACTION_H
#define _SLKACTION_H

#include <stdio.h>
#include <stdlib.h>
#include "SlkToken.h"
#include "SlkTree.h"

#define STACKSIZE   511

typedef struct _stack
{   double   *top,
             *end,
              start [STACKSIZE + 1];
} stack;

typedef struct _node { double   item;
                       struct
                      _node    *left,
                               *right;
} node_t;

typedef struct _stack2
{   node_t  **top,
            **end,
             *start [STACKSIZE + 1];
} stack2;


class SlkAction : public SlkTree
{

public:

    SlkAction ( SlkToken &scanner,
                int       display ); 

    double      get_Answer ( void )          { return  Answer; }
    node_t     *get_Tree ( void )            { return  Tree; }
    double      pre_order ( node_t  *tree );
    double      post_order ( node_t  *tree );
    void        state ( slk_size_t  number ) { }

private:

    SlkToken   *scanner;
    stack       Semantic_stack;
    double      Answer;
    node_t     *Tree;
    stack2      Node_stack;

    void dump_stack ( stack   s );
    node_t * make_node ( double   item, node_t  *left, node_t  *right );

#include "SlkExecute.txt"

};

#endif

